// import {login,loginWithSMS} from '../api/auth'

// export const useAuth=()=>{
//     const handleLogin=async(username:string,password:string)=>{
//         const response = await login(username, password);
//         const data = response.data; // 提取 AxiosResponse 的 data 属性
//         localStorage.setItem('access_token',data.accessToken)
//         localStorage.setItem('refresh_token',data.refreshToken)
//         localStorage.setItem('expires_at',
//             (Date.now()+data.expiresIn*1000).toString()
//         )
//     }

//     const handleSMSLogin=async (phone:string,code:string)=>{
//         const response = await loginWithSMS(phone, code);
//         const data = response.data; // 提取 AxiosResponse 的 data 属性
//         localStorage.setItem('access_token',data.accessToken)
//         localStorage.setItem('refresh_token',data.refreshToken)
//         localStorage.setItem('expires_at',
//             (Date.now()+data.expiresIn*1000).toString()
//         )
//     }
//     return {handleLogin,handleSMSLogin}
// }
